<?php
	$blog_edit = array(
		'title' => 	'<div class="head">'.
			'<h1>' . __d('lil', 'Edit a Blog', true) . '</h1>'.
			'</div>',
		'form' => array(
			'pre' => '<div class="form">',
			'post' => '</div>',
			'lines' => array(
				'form_start' => array(
					'class' => $form,
					'method' => 'create',
					'parameters' => array('model' => 'Blog')
				),
				'referer' => array(
					'class' => $form,
					'method' => 'hidden',
					'parameters' => array('field' => 'referer')
				),
				'id' => array(
					'class' => $form,
					'method' => 'hidden',
					'parameters' => array('field' => 'id')
				),
				'name' => array(
					'class' => $form,
					'method' => 'input',
					'parameters' => array(
						'field' => 'name',
						'options' => array(
							'label' => __d('lil', 'Name', true) . ':',
							'error' => __d('lil', 'Blog name is required.', true),
							'class' => 'big'
						)
					)
				),
				'slug' => 
					(Configure::read('Lil.blogSlug') != 'manual') ? array() :
					array(
						'class' => $form,
						'method' => 'input',
						'parameters' => array(
							'field' => 'slug',
							'options' => array(
								'label' => __d('lil', 'Slug', true) . ':',
								'error' => __d('lil', 'Slug must only use letters, numbers, underscores or hyphens.', true),
							)
						)
					),
				'description' => array(
					'class' => $form,
					'method' => 'input',
					'parameters' => array(
						'field' => 'description',
						'options' => array(
							'label' => __d('lil', 'Description', true) . ':',
							'error' => __d('lil', 'Blog description is required.', true),
						)
					)
				),
				'author' => array(
					'class' => $form,
					'method' => 'input',
					'parameters' => array(
						'field' => 'Author',
						'options' => array(
							'label' => __d('lil', 'Author', true) . ':',
						)
					)
				),
				'submit' => array(
					'class' => $form,
					'method' => 'submit',
					'parameters' => array(
						'label' => __d('lil', 'Save', true)
					)
				),
				'form_end' => array(
					'class' => $form,
					'method' => 'end',
					'parameters' => array()
				),
			)
		)
	);
	
	$blog_edit = $this->callPluginHandlers('form_edit_blog', $blog_edit);
	
	// form display begins
	echo $blog_edit['title']; 
	
	echo $blog_edit['form']['pre']; 
	foreach ($blog_edit['form']['lines'] as $name => $line) {
		if (!empty($line['class'])) {
			$parameters = array();
			if (!empty($line['parameters'])) {
				$parameters = (array)$line['parameters'];
			}
			echo call_user_func_array(array($line['class'], $line['method']), $parameters);
		}
	}
	echo $blog_edit['form']['post']; 
?>